#ifndef NETADDRESS_HPP
#define NETADDRESS_HPP

#include <cstdlib>
#include <string>

#include "sockets.hpp"

class UdpSocket;
class TcpSocket;

class NetAddress
{
	public:
	
	NetAddress();
	void resolve( std::string const& hostname, int port );
	bool isValid() const;
	
	
	private:
	
	bool validData;
	
	friend class UdpSocket;
	friend class TcpSocket;
	
	#if defined(_MSC_VER)
	typedef __int64 sckimpl_sa_align_t;
	#else
	typedef long long sckimpl_sa_align_t;
	#endif

	static std::size_t const sckimpl_sa_maxsize = 32; /* IPv6 needs 28 bytes */

	struct internet_addr
	{
		char               _ss_pad1[sizeof(sckimpl_sa_align_t)];
		sckimpl_sa_align_t _ss_align;
		char               _ss_pad2[sckimpl_sa_maxsize - sizeof(sckimpl_sa_align_t)*2];
	};
	
	internet_addr data;
};

#endif //NETADDRESS_H

